
package com.showcai.controller.user;

import com.showcai.controller.base.BaseController;
import com.showcai.result.ResultObj;
import com.showcai.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by lutao on 2017/7/14.
 */
@RequestMapping("/user")
@Controller
public class UserController extends BaseController {
@Autowired
    UserService userService;
    @RequestMapping(value = "/login")
    @ResponseBody
    public ResultObj login(Long userId) {
        logger.info("userId===>>"+userId);
        ResultObj resultObj = new ResultObj();
            resultObj.setData(userService.getUserById(userId));
            resultObj.setMsg("操作成功！");
        return resultObj;
    }
@RequestMapping(value = "/getUserList")
    @ResponseBody
    public ResultObj getUserList(Integer page,Integer pageSize) {
        logger.info("getUserList===>>");
        ResultObj resultObj = new ResultObj();
        resultObj.setData(userService.getUserList(page,pageSize));
        resultObj.setMsg("操作成功！");
        return resultObj;
    }
    @RequestMapping(value = "/user/Sync")
    @ResponseBody
    public String userSync() {
        logger.info("getUserList===>>");
        ResultObj resultObj = new ResultObj();
            resultObj.setData("");
            resultObj.setMsg("操作成功！");
        return resultObj.toJson();
    }


}
